var verifyPostorder = function (postorder) {
  if (!postorder.length) return true;
  let root = postorder.pop();
  let len = postorder.length;
  while (postorder[len - 1] > root) len--;
  let left = postorder.slice(0, len);
  if (left.some(node => node > root)) return false;
  return verifyPostorder(left) && verifyPostorder(postorder.slice(len));
}